import time

import pytest

from pageobjects.LoginPage import LoginPage


class TestRun:
    __NAME = "zhangsan"
    __PASSWORD = "123456"
    def setup_class(self):
        self.blog = LoginPage().login(self.__NAME, self.__PASSWORD)
        # self.blog.alert_accept()
        time.sleep(5)
        print("测试开始")
    def teardown_class(self):
        self.blog.do_quit()

    @pytest.mark.parametrize("title,text",[("自动化测试", "阿玛特拉斯")])
    @pytest.mark.order(1)
    # @pytest.mark.skip
    def test_add_blog(self,title,text):
        # time.sleep(5)
        self.blog.click_write().write_blog(title,text)

    @pytest.mark.parametrize("title,text",[("自动化测试","Ciallo～(∠・ω<)⌒☆\n先輩、お早う！！！\n今日も元気？")])
    @pytest.mark.order(2)
    # @pytest.mark.skip
    def test_update_blog(self,title,text):
        self.blog.view_blog(title).click_update().update_blog(text=text)

    @pytest.mark.parametrize("title",[("自动化测试")])
    @pytest.mark.order(3)
    @pytest.mark.skip
    def test_delete_blog(self,title):
        self.blog.view_blog(title).click_delete()